package com.example.showlocation;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;

import com.tencent.lbssearch.object.param.WalkingParam;
import com.tencent.lbssearch.object.result.WalkingResultObject;
import com.tencent.map.geolocation.TencentLocationManager;
import com.tencent.tencentmap.mapsdk.maps.TencentMapInitializer;
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;

public class WalkingActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        TencentMapInitializer.setAgreePrivacy(true);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_walking);
        TencentLocationManager.setUserAgreePrivacy(true);
    }
    @SuppressLint("IntentReset")
    public void Walking(View view) throws Exception {
        LatLng latLngfrom=  new LatLng(34.801843,113.551044)  ;
        //LatLng latLngto=  new LatLng(39.908710,116.397499)  ;
        LatLng latLngto=  new LatLng(34.801843,113.551054)  ;

        WalkingParam walkingParam=new WalkingParam(latLngfrom, latLngto);
        WalkingResultObject walkingResultObject= walkingParam.getResultClass().newInstance();
        //java.lang.Class<WalkingResultObject> walkingResultObject= walkingParam.getResultClass();
        float distance=walkingResultObject.result.routes.get(0).distance/1000;
        if (walkingResultObject.result == null) {

        }
        Log.d(getLocalClassName()+":", String.valueOf(distance));
    }

}